/*
 * Leaf.java
 * business
 *
 * Created by ChenTao on 2017/1/14.
 *
 * Copyright (c) 2017年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.data.address;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;

/** Area */
public class Area implements Parcelable {

    @SerializedName("parent_id")
    private int parentId;

    @SerializedName("region_id")
    private int regionId;

    @SerializedName("region_name")
    private String regionName;

    private boolean selected;

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    public int getParentId() {
        return parentId;
    }

    public void setParentId(int parentId) {
        this.parentId = parentId;
    }

    public int getRegionId() {
        return regionId;
    }

    public void setRegionId(int regionId) {
        this.regionId = regionId;
    }

    public String getRegionName() {
        return regionName;
    }

    public void setRegionName(String regionName) {
        this.regionName = regionName;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.parentId);
        dest.writeInt(this.regionId);
        dest.writeString(this.regionName);
        dest.writeByte(this.selected ? (byte) 1 : (byte) 0);
    }

    public Area() {
    }

    protected Area(Parcel in) {
        this.parentId = in.readInt();
        this.regionId = in.readInt();
        this.regionName = in.readString();
        this.selected = in.readByte() != 0;
    }

    public static final Parcelable.Creator<Area> CREATOR = new Parcelable.Creator<Area>() {
        @Override
        public Area createFromParcel(Parcel source) {
            return new Area(source);
        }

        @Override
        public Area[] newArray(int size) {
            return new Area[size];
        }
    };
}
